﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;

namespace Calculator
{
    public class CalculatorReader
    {
        public float ReadNumber(ICalculator calculator)
        {
            var text = calculator.GetTextFromScreen();
            var ci = GetCultureInfo();
            return float.Parse(text, ci);
        }

        private static CultureInfo GetCultureInfo()
        {
            var ci = CultureInfo.InvariantCulture.Clone() as CultureInfo;
            ci.NumberFormat.NumberDecimalSeparator = ".";
            return ci;
        }
    }
}
